package c.j.a.d.a.c;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import java.util.Iterator;
import org.json.JSONObject;

/* compiled from: CustomJumpDevicePlan */
public class c extends a {
    public final JSONObject c;

    public c(Context context, String str, JSONObject jSONObject) {
        super(context, str);
        this.c = jSONObject;
    }

    public Intent b() {
        String optString = this.c.optString("action");
        String optString2 = this.c.optString("category");
        int optInt = this.c.optInt("flags", 1342210048);
        String optString3 = this.c.optString("path_extra_key");
        String optString4 = this.c.optString("path_data_key");
        JSONObject optJSONObject = this.c.optJSONObject("extra");
        JSONObject optJSONObject2 = this.c.optJSONObject("extra_type");
        if (TextUtils.isEmpty(optString)) {
            return null;
        }
        Intent intent = new Intent(optString);
        if (!TextUtils.isEmpty(optString2)) {
            intent.addCategory(optString2);
        }
        if (!TextUtils.isEmpty(optString4)) {
            try {
                intent.setData(Uri.parse(String.format(optString4, new Object[]{this.b})));
            } catch (Throwable unused) {
            }
        }
        intent.setFlags(optInt);
        if (!TextUtils.isEmpty(optString3)) {
            intent.putExtra(optString3, this.b);
        }
        if (!(optJSONObject == null || optJSONObject2 == null || optJSONObject.length() != optJSONObject2.length())) {
            Iterator keys = optJSONObject.keys();
            if (keys != null) {
                while (keys.hasNext()) {
                    String str = (String) keys.next();
                    optString3 = optJSONObject2.optString(str);
                    if (optString3 != null) {
                        Object obj = -1;
                        switch (optString3.hashCode()) {
                            case -1325958191:
                                if (optString3.equals("double")) {
                                    obj = null;
                                    break;
                                }
                                break;
                            case -891985903:
                                if (optString3.equals("string")) {
                                    obj = 1;
                                    break;
                                }
                                break;
                            case 104431:
                                if (optString3.equals("int")) {
                                    obj = 2;
                                    break;
                                }
                                break;
                            case 3327612:
                                if (optString3.equals("long")) {
                                    obj = 3;
                                    break;
                                }
                                break;
                            case 64711720:
                                if (optString3.equals("boolean")) {
                                    obj = 4;
                                    break;
                                }
                                break;
                        }
                        switch (obj) {
                            case null:
                                intent.putExtra(str, optJSONObject.optDouble(str));
                                break;
                            case 1:
                                intent.putExtra(str, optJSONObject.optString(str));
                                break;
                            case 2:
                                intent.putExtra(str, optJSONObject.optInt(str));
                                break;
                            case 3:
                                intent.putExtra(str, optJSONObject.optLong(str));
                                break;
                            case 4:
                                intent.putExtra(str, optJSONObject.optBoolean(str));
                                break;
                            default:
                                break;
                        }
                    }
                }
            }
        }
        return intent;
    }
}
